package com.huawei.M01.iterator;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * 最好的扑克
 *
 * @author zhiwu
 */
public class BestHand {
    public String bestHand(int[] ranks, char[] suits) {
        // 用于存放花色的set
        Set<Character> suitSet = new HashSet<>(5);
        // 用于存放牌大小的map
        Map<Integer, Integer> ranksMap = new HashMap<>(5);
        for (int i = 0; i < ranks.length; i++) {
            suitSet.add(suits[i]);
            ranksMap.put(ranks[i], ranksMap.getOrDefault(ranks[i], 0) + 1);
        }
        if (suitSet.size() == 1) {
            return "Flush";
        }
        if (ranksMap.keySet().size() == 5) {
            return "High Card";
        }
        if (ranksMap.containsValue(3) || ranksMap.containsValue(4)) {
            return "Three of a Kind";
        }
        return "Pair";
    }

    public static void main(String[] args) {

    }
}
